//
//  RootTabBarController.m
//  TasteEnjoy
//
//  Created by XuRui on 16/4/19.
//  Copyright © 2016年 XuRui. All rights reserved.
//

#import "RootTabBarController.h"

@interface RootTabBarController ()

@end

@implementation RootTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
  
}

- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{

    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    //风格
      self.tabBar.barStyle = UIBarStyleBlack;
    //item色
      self.tabBar.tintColor = [UIColor whiteColor];
    // tabbar背景色
    // self.tabBar.barTintColor = [UIColor blackColor];
        [self create];
    }
    return self;
}


#pragma mark - ------------ 创建根tabbar navi ---------------

- (void)create
{


/** tabBar1 */
    EnjoyViewController *enjoy = [[EnjoyViewController alloc]init];
    RootNavigationController *first = [[RootNavigationController alloc]initWithRootViewController:enjoy];
    first.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Enjoy" image:[UIImage imageNamed:@"tab1"] tag:100]autorelease];
    
    
/** tabBar2 */
    FindViewController *find = [[FindViewController alloc]init];
    RootNavigationController *sec = [[RootNavigationController alloc]initWithRootViewController:find];
    sec.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Gallery" image:[UIImage imageNamed:@"tab2"] tag:200]autorelease];

    
/** tabBar3 */
    LiveViewController *live = [[LiveViewController alloc]init];
    RootNavigationController *third = [[RootNavigationController alloc]initWithRootViewController:live];
    third.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Topic" image:[UIImage imageNamed:@"tab3"] tag:300]autorelease];

    
/** tabBar4 */
    MineViewController *mine = [[MineViewController alloc]init];
    RootNavigationController *four = [[RootNavigationController alloc]initWithRootViewController:mine];
    four.tabBarItem = [[[UITabBarItem alloc]initWithTitle:@"Mine" image:[UIImage imageNamed:@"tab4"] tag:400]autorelease];
    
    
    self.viewControllers = @[first, sec,third,four];
    
    [enjoy release];
    [first release];
    
    
    [find release];
    [sec release];
    
    [live release];
    [third release];
    
    
    [mine release];
    [four release];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
